package com.itheima.d5_resource;

import java.io.*;

public class Test3 {
    public static void main(String[] args) {
        try(
                InputStream is=new FileInputStream("C:\\Users\\dell\\IdeaProjects\\file-io-app\\src\\img.png");
                OutputStream os=new FileOutputStream("C:\\Users\\dell\\IdeaProjects\\file-io-app\\src\\img2.png");
                MyConnection myConnection=new MyConnection();
                ) {
            byte[] buffer=new byte[1024];

            int len;
            while((len=is.read(buffer))!=-1){
                os.write(buffer,0,len);
            }
            System.out.println(myConnection);
            System.out.println("复制完成");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
